package com.grts.mall.mapper;

import java.util.List;

import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import com.grts.mall.pojo.Order;
import com.grts.mall.pojo.OrderExample;
import com.grts.mall.pojo.vo.HomeResultVo;
import com.grts.mall.pojo.vo.OrderSearchConditionVO;

/**
 * @author Administrator
 *
 */
@Mapper
public interface OrderMapper {
    long countByExample(OrderExample example);

    int deleteByExample(OrderExample example);

    int deleteByPrimaryKey(Long oid);

    int insert(Order record);

    int insertSelective(Order record);

    List<Order> selectByExample(OrderExample example);

    Order selectByPrimaryKey(Long oid);

    int updateByExampleSelective(@Param("record") Order record, @Param("example") OrderExample example);

    int updateByExample(@Param("record") Order record, @Param("example") OrderExample example);

    int updateByPrimaryKeySelective(Order record);

    int updateByPrimaryKey(Order record);
    
    long countByKey(OrderSearchConditionVO vo);
    
    List<Order> selectPageList(OrderSearchConditionVO vo);
    
    @Select("SELECT DATE_FORMAT(create_time,'%Y-%m-%d') as date, count(*) as count FROM `order` WHERE DATE_SUB(CURDATE(), INTERVAL 7 DAY) <= date(create_time)  GROUP BY date " )
    List<HomeResultVo> selectVos ();
}